<template>
  <div class="home_container">
    <el-card>
      <div class="home_card">
        <img
          class="home_card-avatar"
          :src="userStore.avatar"
          :alt="userStore.avatar"
        />
        <div class="home_card-content">
          <h2>{{ getTime() + "好," }}{{ userStore.username }}</h2>
          <p>{{ setting.title }}！！！</p>
        </div>
      </div>
    </el-card>
    <img class="home_image" src="../../assets/images/index.svg" alt="Minions" />
  </div>
</template>
<script setup lang="ts">
//引入用户相关的仓库,获取当前用户的头像、昵称
import useUserStore from "@/store/modules/user";
import { getTime } from "@/utils/time";
import setting from "@/setting";
//获取存储用户信息的仓库对象
let userStore = useUserStore();
</script>
<style scoped lang="scss">
.home_container {
  text-align: center;

  .home_card {
    display: flex;

    .home_card-avatar {
      width: 200px;
      height: 200px;
      object-fit: cover;
      border-radius: 50%;
    }

    .home_card-content {
      margin-left: 32px;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      font-weight: 500;
      text-align: left;

      h2 {
        font-size: 48px;
      }

      p {
        font-size: 24px;
        color: #ccc;
      }
    }
  }

  .home_image {
    margin-top: 16px;
    width: 35%;
  }
}

@media (max-width: 1280px) {
  .home_card-avatar {
    width: 150px !important;
    height: 150px !important;
  }

  .home_card-content {
    margin-left: 16px !important;

    h2 {
      font-size: 36px !important;
    }

    p {
      font-size: 22px !important;
    }
  }
}

@media (max-width: 768px) {
  .home_card-avatar {
    width: 100px !important;
    height: 100px !important;
  }

  .home_card-content {
    margin-left: 12px !important;

    h2 {
      font-size: 24px !important;
    }

    p {
      font-size: 16px !important;
    }
  }
}
</style>
